package org.breathe.command;

import lombok.Getter;
import org.breathe.command.impl.hash.HDel;
import org.breathe.command.impl.hash.HGet;
import org.breathe.command.impl.hash.HSet;
import org.breathe.command.impl.list.*;
import org.breathe.command.impl.personal.Breathe;
import org.breathe.command.impl.ping.Hello;
import org.breathe.command.impl.rdb.Bgsave;
import org.breathe.command.impl.selector.Select;
import org.breathe.command.impl.set.SAdd;
import org.breathe.command.impl.set.SPop;
import org.breathe.command.impl.set.SRem;
import org.breathe.command.impl.string.Get;
import org.breathe.command.impl.ping.Ping;
import org.breathe.command.impl.string.Set;
import org.breathe.command.impl.zset.ZAdd;
import org.breathe.command.impl.zset.ZRange;
import org.breathe.server.core.RedisCore;

import java.util.function.Function;

/**
 * @author: breathe
 * @createTime: 2025-05-12
 */
@Getter
public enum CommandType {
    PING(core -> new Ping()),
    SET(Set::new),
    GET(Get::new),
    SADD(SAdd::new),
    SPOP(SPop::new),
    SREM(SRem::new),
    LPUSH(LPush::new),
    LPOP(LPop::new),
    LRANGE(LRange::new),
    RPOP(RPop::new),
    RPUSH(RPush::new),
    RRANGE(RRange::new),
    BREATHE(Breathe::new),
    HSET(HSet::new),
    HGET(HGet::new),
    HDEL(HDel::new),
    ZADD(ZAdd::new),
    ZRANGE(ZRange::new),
    LLEN(LLen::new),
    SELECT(Select::new),
    BGSAVE(Bgsave::new),
    HELLO(Hello::new);
    private final Function<RedisCore, Command> supplier;
    CommandType(Function<RedisCore, Command> supplier) {
        this.supplier = supplier;
    }
}
